package com.yanqu.road.entity.activity.foxcard.config;

import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_s_activity_fox_treelevel")
public class FoxCardTreeLevelConfig {
    @FieldTypeAnnotation(select = true, orderASC = true, isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "等级", isIndex = true)
    private int level;
    @FieldTypeAnnotation(desc = "参数")
    private String param;
    @FieldTypeAnnotation(desc = "当前等级需求经验")
    private int exp;
    @FieldTypeAnnotation(desc = "解签消耗数量")
    private int rollConsume;
    @FieldTypeAnnotation(desc = "初始生成卡牌")
    private String initialCard;
    @FieldTypeAnnotation(desc = "组合等级")
    private int comboLevel;
    @FieldTypeAnnotation(desc = "可跳过关卡")
    private String canSkipChapter;
    @FieldTypeAnnotation(desc = "21点大奖奖励")
    private String bigReward;

    List<Integer> params = new ArrayList<>();
    List<Integer> initCards = new ArrayList<>();
    List<Integer> fastPassIds = new ArrayList<>();
    List<List<Property>> bigRewardList = new ArrayList<>();

    public FoxCardTreeLevelConfig(ResultSet rs) throws SQLException {
        this.activityId = rs.getInt("activityId");
        this.level = rs.getInt("level");
        this.param = rs.getString("param");
        this.exp = rs.getInt("exp");
        this.rollConsume = rs.getInt("rollConsume");
        this.initialCard = rs.getString("initialCard");
        this.comboLevel = rs.getInt("comboLevel");
        this.canSkipChapter = rs.getString("canSkipChapter");
        this.bigReward = rs.getString("bigReward");

        this.params = StringUtils.stringToIntegerList(this.param, "\\|");
        this.initCards = StringUtils.stringToIntegerList(this.initialCard, "\\|");
        this.fastPassIds = StringUtils.stringToIntegerList(this.canSkipChapter, "\\|");
        this.bigRewardList = PropertyHelper.parseNewStringToPropertyList(this.bigReward);
    }

    public int getActivityId() {
        return activityId;
    }

    public int getLevel() {
        return level;
    }

    public String getParam() {
        return param;
    }

    public int getGold() {
        return params.get(0);
    }

    public int getNum() {
        return params.get(1);
    }

    public int getExp() {
        return exp;
    }

    public int getRollConsume() {
        return rollConsume;
    }

    public List<Integer> getParams() {
        return params;
    }

    public String getInitialCard() {
        return initialCard;
    }

    public int getComboLevel() {
        return comboLevel;
    }

    public String getCanSkipChapter() {
        return canSkipChapter;
    }

    public String getBigReward() {
        return bigReward;
    }

    public List<Integer> getInitCards() {
        return initCards;
    }

    public List<Integer> getFastPassIds() {
        return fastPassIds;
    }

    public List<List<Property>> getBigRewardList() {
        return bigRewardList;
    }
}
